﻿using Cache;
using DtoFw;
using DtoFw.Base;
using DtoFw.Query;
using DtoFw.Result;
using Microsoft.AspNetCore.Mvc;
using Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SceneEvidenceAPI.Controllers
{
    /// <summary>
    /// 物品流转
    /// </summary>
    [Route("api/evidence/transfere")]
    public class EvidenceTransfereController : BaseController
    {
        private readonly EvidenceTransfereService _evidenceTransfereService;
        public EvidenceTransfereController(EvidenceTransfereService evidenceTransfereService)
        {
            _evidenceTransfereService = evidenceTransfereService;
        }
        /// <summary>
        /// 新增
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public BaseGenericResult<TransfereEvidencePostRespDto> Post([FromBody] EvidenceTransfereListPostReqDto evidenceTransfereReqDto)
        {
            return _evidenceTransfereService.Post(evidenceTransfereReqDto);
        }
        /// <summary>
        /// 流转记录
        /// </summary>
        /// <param name="reqDto"></param>
        /// <returns></returns>
        [HttpGet("pager")]
        public BaseGenericResult<Pager<EvidenceTransferePagerRespDto>> QueryEvidenceTransferePager([FromQuery] EvidenceTransfereQueryReqDto reqDto)
        {
            return _evidenceTransfereService.QueryEvidenceTransferePager(reqDto);
        }
        /// <summary>
        /// 获取流转物品
        /// </summary>
        /// <param name="TransfereId"></param>
        /// <returns></returns> 
        [HttpGet("{transfereId}/list")]
        public BaseGenericResult<List<TransfereEvidenceRespDto>> GetTransfereEvidences(long transfereId)
        {
            return _evidenceTransfereService.GetTransfereEvidences(transfereId);
        }
        /// <summary>
        /// 最新动态
        /// </summary>
        /// <returns></returns>
        [HttpGet("home/trends")]
        public BaseGenericResult<TransfereEvidenceTrendResDto> GetTransfereEvidenceTrends()
        {
            var _user = TokenHelper.GetTokenInfo<TokenData>(User);
            return _evidenceTransfereService.GetTransfereEvidenceTrends(_user);
        }
    }
}
